import React, {PropsWithChildren} from 'react'
import {View} from "@tarojs/components";
import MyNavigationBar, {useMyNavigationBarHeight} from "./MyNavigationBar";

export interface ScaffoldProps extends PropsWithChildren {
    title: React.ReactNode,
    style?: React.CSSProperties
    hasCustomBottomBar?: boolean
}

const Scaffold: React.FC<ScaffoldProps> = ({title, children, style,hasCustomBottomBar}) => {
    let myNavigationBarHeight = useMyNavigationBarHeight();
    return <>
        <MyNavigationBar>{title}</MyNavigationBar>
        <View style={{
            backgroundColor:"transparent",
            ...style,
            height: `calc(100vh - ${myNavigationBarHeight}px${hasCustomBottomBar?` - 50px`:''})`,
        }}>
            {children}
        </View>
    </>
}

export default Scaffold


